package io.gitee.cloudladder.obsidian.swagger2.example.controller;

import io.gitee.cloudladder.obsidian.swagger2.annotation.ApiOperationSort;
import io.gitee.cloudladder.obsidian.swagger2.example.entity.BaseDataTypeParamObject;
import io.gitee.cloudladder.obsidian.swagger2.example.entity.ExtendDataTypeParamObject;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;
import java.time.LocalDate;
import java.util.*;

@Slf4j
@Api(value = "Test Response Controller")
@RestController
public class TestResponseController {

    @ApiOperationSort(1)
    @PostMapping("/test/response/string")
    public String testResponseString() {
        return "test response string";
    }

    @ApiOperationSort(2)
    @PostMapping("/test/response/byte")
    public Byte testResponseByte() {
        return 1;
    }

    @ApiOperationSort(3)
    @PostMapping("/test/response/short")
    public Short testResponseShort() {
        return 1;
    }

    @ApiOperationSort(4)
    @PostMapping("/test/response/integer")
    public Integer testResponseInteger() {
        return 1;
    }

    @ApiOperationSort(5)
    @PostMapping("/test/response/long")
    public Long testResponseLong() {
        return 1l;
    }

    @ApiOperationSort(6)
    @PostMapping("/test/response/float")
    public Float testResponseFloat() {
        return 1.0f;
    }

    @ApiOperationSort(7)
    @PostMapping("/test/response/double")
    public Double testResponseDouble() {
        return 1.0;
    }

    @ApiOperationSort(8)
    @PostMapping("/test/response/file")
    public File testResponseFile() {
        return new File("");
    }

    @ApiOperationSort(9)
    @PostMapping("/test/response/date")
    public Date testResponseDate() {
        return new Date();
    }

    @ApiOperationSort(10)
    @PostMapping("/test/response/localDate")
    public LocalDate testResponseLocalDate() {
        return LocalDate.now();
    }

    @ApiOperationSort(11)
    @PostMapping("/test/response/array/string")
    public String[] testResponseArrayString() {
        return new String[] {"1", "2"};
    }

    @ApiOperationSort(12)
    @PostMapping("/test/response/array/integer")
    public Integer[] testResponseArrayInteger() {
        return new Integer[] {1, 2};
    }

    @ApiOperationSort(13)
    @PostMapping("/test/response/list/string")
    public List<String> testResponseListString() {
        return Arrays.asList("1", "2");
    }

    @ApiOperationSort(14)
    @PostMapping("/test/response/list/integer")
    public List<Integer> testResponseListInteger() {
        return Arrays.asList(1, 2);
    }

    @ApiOperationSort(15)
    @PostMapping("/test/response/map")
    public Map<String, String> testResponseMap() {
        return new HashMap<>();
    }

    @ApiOperationSort(16)
    @PostMapping("/test/response/object/base")
    public BaseDataTypeParamObject testResponseBaseObject() {
        return new BaseDataTypeParamObject();
    }

    @ApiOperationSort(17)
    @PostMapping("/test/response/object/extend")
    public ExtendDataTypeParamObject testResponseExtendObject() {
        return new ExtendDataTypeParamObject();
    }
}
